export function getLastSeven() {
  var d = new Date()
  var last = new Date(d.setDate(d.getDate() - 7))
  var y = last.getFullYear()
  var m = (last.getMonth() + 1).toString().padStart(2, 0)
  var t = last.getDate().toString().padStart(2, 0)
  return `${y}-${m}-${t}`
}
export function getDay() {
  var d = new Date()
  var y = d.getFullYear()
  var m = (d.getMonth() + 1).toString().padStart(2, 0)
  var t = d.getDate().toString().padStart(2, 0)
  return `${y}-${m}-${t}`
}
export function getYear() {
  var d = new Date()
  var y = d.getFullYear()
  return `${y}`
}
export function getMonth() {
  var d = new Date()
  var y = d.getFullYear()
  var m = (d.getMonth() + 1).toString().padStart(2, 0)
  return `${y}-${m}`
}
export function getLastMonth() {
  var d = new Date()
  let y = d.getFullYear()
  let m = (d.getMonth()).toString().padStart(2, 0)
  if (m === '00') {
    y = y - 1
    m = 12
  }
  return `${y}-${m}`
}
export function getTime() {
  var d = new Date()
  var y = d.getFullYear()
  var m = (d.getMonth() + 1).toString().padStart(2, 0)
  var t = d.getDate().toString().padStart(2, 0)
  var h = d.getHours().toString().padStart(2, 0)
  var min = d.getMinutes().toString().padStart(2, 0)
  var s = d.getSeconds().toString().padStart(2, 0)
  return `${y}-${m}-${t} ${h}:${min}:${s}`
}
// 获取本月天数
export function currentDay() {
  var d = new Date()
  var y = d.getFullYear()
  var m = (d.getMonth() + 1).toString().padStart(2, 0)
  var d = new Date(y, m, 0).getDate()
  return d
}
// 获取下月天数
export function nextDay() {
  var d = new Date();
  var y = d.getFullYear();
  var m = d.getMonth();
  var nextMonthDays = new Date(y, m + 2, 0).getDate();
  return nextMonthDays
}
